package com.ky.my.service.impl;

import com.ky.common.vo.R;
import com.ky.my.entity.BrowsingHistory;
import com.ky.my.mapper.BrowsingHistoryMapper;
import com.ky.my.service.BrowsingHistoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 浏览记录表 服务实现类
 * </p>
 *
 * @author hmt
 * @since 2024-06-17
 */
@Service
public class BrowsingHistoryServiceImpl extends ServiceImpl<BrowsingHistoryMapper, BrowsingHistory> implements BrowsingHistoryService {
   @Autowired
   private BrowsingHistoryMapper browsingHistoryMapper;
    @Override
    public R findAll() {
        List<BrowsingHistory> historyList = browsingHistoryMapper.selectList(null);
        return R.ok(historyList);
    }

    @Override
    public R deleteByHistoryId(Integer historyId) {
      /*  QueryWrapper<BrowsingHistory> queryWrapper = new QueryWrapper<>();*/
        int i = browsingHistoryMapper.deleteById(historyId);
       /* queryWrapper.eq("historyId",historyId);
        int i = browsingHistoryMapper.delete(queryWrapper);*/
        return R.ok(i);
    }
}
